package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.service.CostomerProjectService;
import com.zzyl.vo.NursingPlanVo;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 查询护理项目
 *
 * @Description CostomerProjectController
 * @Author KangChi Wang
 * @Date 2024-08-31
 */
@Api(tags = "护理项目")
@RestController
@RequestMapping(("/customer/orders/project"))
@Slf4j
public class CostomerProjectController extends BaseController {
    @Autowired
    private CostomerProjectService costomerProjectService;

    @GetMapping("/page")
    @ApiOperation("分页查询")
    //分页查询护理项目
    public ResponseResult<PageResponse<NursingProjectVo>> getByPage(
            @ApiParam(value = "当前页码")
            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
            @ApiParam(value = "每页数量")
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
            @ApiParam(value = "项目名称")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(value = "项目状态")
            @RequestParam(value = "status", required = false) Integer status) {
        PageResponse<NursingProjectVo> page = costomerProjectService.page(pageNum, pageSize, name, status);

        return success(page);
    }

    @ApiOperation("查询项目详情根据id")
    @GetMapping("/{id}")
    public ResponseResult<NursingProjectVo> getById(@PathVariable Long id){
        NursingProjectVo info = costomerProjectService.getById(id);
        return success(info);
    }
}
